# Contributor: Sören Tempel <soeren+alpine@soeren-tempel.net>
# Maintainer: Sören Tempel <soeren+alpine@soeren-tempel.net>
pkgname=spike
pkgver=1.1.0
pkgrel=0
pkgdesc="A simulator for the RISC-V instruction set architecture"
url="https://github.com/riscv-software-src/riscv-isa-sim"
arch="all !riscv64"
license="BSD-3-Clause"
makedepends="dtc"
options="!check" # XXX: no proper upstream test suite
source="
	https://github.com/riscv-software-src/riscv-isa-sim/archive/refs/tags/v$pkgver/spike-$pkgver.tar.gz
	0001-fix-with-gcc13.patch"
builddir="$srcdir/riscv-isa-sim-$pkgver"

prepare() {
	default_prepare
	update_config_sub
}

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var
	make
}

package() {
	# The shared libraries provided by spike aren't versioned,
	# hence there is really no use in packaging them right now.
	make DESTDIR="$pkgdir" install-exes
}

sha512sums="
089f3ae8e505ffde7bb4d3d7ef2c5db082c616e135e4efe952151dd195b1493f46ae4c0e33fc6b708935397b80922c643cb9e66760cbf3b2286f1f927e8dee9a  spike-1.1.0.tar.gz
08007f8ebe03ba29f41663ddc69a0c324e63c4a5156aaffec62392d9ba5feaec99ac7be88c23c0b9a25c4f1bdfdaa525ce513ae6f2a4721d2e1dbf659247db12  0001-fix-with-gcc13.patch
"
